#include <iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<cstring>
#include <queue>
using namespace std;
typedef long long ll;
const int N = 5e5 + 10;
int n, m;
int a[N];
vector<int> e[N];
int dep[N], fa[N][20];
bool vis[N];
ll dis[N];
void dfs(int u, int father) {
	dep[u] = dep[father] + 1;
	fa[u][0] = father;
	for (int i = 1; i <= 19; i++)
	{
		fa[u][i] = fa[fa[u][i - 1]][i - 1];
	}
	for (int& v : e[u])
	{
		if (v != father) {
			dis[v] = dis[u] + a[v];
			dfs(v, u);
		}
	}
}
int lca(int u, int v)
{
	if (dep[u] < dep[v]) {
		swap(u, v);
	}
	//先跳到同一层
	for (int i = 19; i >= 0; i--)
	{
		if (dep[fa[u][i]] >= dep[v]) {
			u = fa[u][i];
		}
	}
	if (u == v) {
		return v;
	}
	//再跳到LCA的下一层
	for (int i = 19; i >= 0; i--)
	{
		if (fa[u][i] != fa[v][i]) {
			u = fa[u][i], v = fa[v][i];
		}
	}
	return fa[u][0];
}
ll redis(int x, int y)
{
	int fa = lca(x, y);
	return dis[x] + dis[y] - 2 * dis[fa] + a[fa];
}
int main()
{
	cin >> n >> m;
	for (int i = 1; i < n; i++) {
		int x, y;
		cin >> x >> y;
		e[x].push_back(y);
		e[y].push_back(x);
	}
	for (int i = 1; i <= n; i++) a[i] = e[i].size();
	dis[1] = a[1];
	dfs(1, 0);
	while (m--) {
		int x, y;
		cin >> x >> y;
		cout << redis(x, y) << endl;
	}
	return 0;
}